#include <stdio.h>

#define MAX_SPEED (110)
#define MIN_SPEED (70)
#define ZERO (0)
#define MIN_HOUR (0.0)
#define MAX_HOUR (24.0)


int main(int argc, const char ** argv)
{
	double length = 0.0;
	double start_time = 0.0;
	double end_time = 0.0;
	double speed = 0.0;
	const char * msg = NULL;
	
	/*
	 * user input
	 */
	printf("Route length: ");
	scanf("%lf", &length);
	printf("Departure time: ");
	scanf("%lf", &start_time);
	printf("Arrival time: ");
	scanf("%lf", &end_time);
	
	/*
	 * validate user input
	 */
	if (start_time < MIN_HOUR || start_time > MAX_HOUR) {
		printf("Error! departure time must be in range 0..24\n");
		return -1;
	}
	if (end_time < MIN_HOUR || end_time > MAX_HOUR) {
		printf("Error! arrival time must be in range 0..24\n");
		return -1;
	}
	if (start_time >= end_time) {
		printf("Error! arrival time must be later than departure time\n");
		return -1;
	}
	
	/*
	 * process input
	 */
	speed = length / (end_time - start_time);
	if (speed > MAX_SPEED) {
		msg = "too fast";
	}
	else if (speed >= MIN_SPEED) {
		msg = "very well";
	}
	else if (speed > ZERO && speed < MIN_SPEED) {
		msg = "too slow";
	}
	else {
		msg = "backwards";
	}
	
	/* 
	 * tell the user
	 */
	printf("Average speed: %lf kmh\n", speed);
	printf("You are driving %s\n", msg);
	
	/*
	 * great success!
	 */
	return 0;
}


